package org.soft.xinyu.equipmentmanagement.controller;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.soft.xinyu.equipmentmanagement.entity.MachineSubmachine;
import org.soft.xinyu.equipmentmanagement.result.Result;
import org.soft.xinyu.equipmentmanagement.service.MachineSubmachineService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author vicente
 * @since 2021-11-22
 */
@RestController
@RequestMapping("/machine-submachine")
public class MachineSubmachineController {

    @Autowired
    private MachineSubmachineService machineSubmachineService;

    /**
     * 获取某个设备的附属设备
     * @param machineId
     * @return
     */
    @GetMapping("/getMachineSubmachineListByMachineId")
    public Result<List<MachineSubmachine>> getMachineSubmachineListByMachineId (String machineId) {
        List<MachineSubmachine> machineSubmachineList = machineSubmachineService.list(new QueryWrapper<MachineSubmachine>().eq("machine_id", machineId));
        return Result.success(machineSubmachineList);
    }
}
